// components/team-icons/index.ts
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    career:{
      type:String,
      value:""
    },
    gift:{
      type:String,
      value:""
    },
    name:{
      type:String,
      value:""
    },
    imgHeight:{
      type:String,
      value:"50px",
    },
    imgWidth:{
      type:String,
      value:"50px",
    }
  },
  observers:{
    gift:function(value){
      // console.log("天赋变更",value,this.data.career)
      if(!value){
        this.setData({
          imageUrl:this.data.defaultImage
        })
      }
      else{
        if(this.data.career){
            let careerItem;
            this.data.careerAllArray.forEach((item)=>{
              if(item.name==this.data.career){
                careerItem = item;
              }
            })
            if(careerItem){
              // console.log(careerItem)
               careerItem.children.forEach(element => {
                  if(element.name == value){
                    this.setData({
                      imageUrl:element.url
                    })
                  }
               });
            }
        }
      }
    },
  },
  /**
   * 组件的初始数据
   */
  data: {
    defaultImage:"/images/icon/start.jpg",
    position:'',
    imageUrl:'',
    careerAllArray:[
      {
        name:"骑士",
        children:[{
          name:"防护",
          url:"/images/wow/career/ability_paladin_shieldofthetemplar.jpg"
          },{
            name:"惩戒",
            url:"/images/wow/career/spell_holy_auraoflight.jpg"
          },{
            name:"神圣",
            url:"/images/wow/career/spell_holy_holybolt.jpg"
          }]  
      },
      {
        name:"战士",
        children:[{
          name:"防护",
          url:"/images/wow/career/ability_warrior_defensivestance.jpg"
          },{
            name:"武器",
            url:"/images/wow/career/ability_warrior_savageblow.jpg"
          },{
            name:"狂怒",
            url:"/images/wow/career/ability_warrior_innerrage.jpg"
          }]  
      },
      {
        name:"猎人",
        children:[{
          name:"野兽控制",
          url:"/images/wow/career/ability_hunter_bestialdiscipline.jpg"
          },{
            name:"射击",
            url:"/images/wow/career/ability_hunter_focusedaim.jpg"
          },{
            name:"生存",
            url:"/images/wow/career/ability_hunter_camouflage.jpg"
          }]  
      },
      {
        name:"潜行者",
        children:[{
          name:"奇袭",
          url:"/images/wow/career/ability_rogue_deadlybrew.jpg"
          },{
            name:"狂徒",
            url:"/images/wow/career/ability_rogue_waylay.jpg"
          },{
            name:"敏锐",
            url:"/images/wow/career/ability_stealth.jpg"
          }]  
      },
      {
        name:"牧师",
        children:[{
          name:"神圣",
          url:"/images/wow/career/spell_holy_guardianspirit.jpg"
          },{
            name:"戒律",
            url:"/images/wow/career/spell_holy_powerwordshield.jpg"
          },{
            name:"暗影",
            url:"/images/wow/career/spell_shadow_shadowwordpain.jpg"
          }]  
      },
      {
        name:"死亡骑士",
        children:[{
          name:"鲜血",
          url:"/images/wow/career/spell_deathknight_bloodpresence.jpg"
          },{
            name:"冰霜",
            url:"/images/wow/career/spell_deathknight_frostpresence.jpg"
          },{
            name:"邪恶",
            url:"/images/wow/career/spell_deathknight_unholypresence.jpg"
          }]  
      },
      {
        name:"萨满祭司",
        children:[{
          name:"元素",
          url:"/images/wow/career/spell_nature_lightning.jpg"
          },{
            name:"增强",
            url:"/images/wow/career/spell_shaman_improvedstormstrike.jpg"
          },{
            name:"恢复",
            url:"/images/wow/career/spell_nature_magicimmunity.jpg"
          }]  
      },
      {
        name:"法师",
        children:[{
          name:"奥术",
          url:"/images/wow/career/spell_holy_magicalsentry.jpg"
          },{
            name:"火焰",
            url:"/images/wow/career/spell_fire_firebolt02.jpg"
          },{
            name:"冰霜",
            url:"/images/wow/career/spell_frost_frostbolt02.jpg"
          }]  
      },
      {
        name:"术士",
        children:[{
          name:"痛苦",
          url:"/images/wow/career/spell_shadow_deathcoil.jpg"
          },{
            name:"恶魔学识",
            url:"/images/wow/career/spell_shadow_metamorphosis.jpg"
          },{
            name:"毁灭",
            url:"/images/wow/career/spell_shadow_rainoffire.jpg"
          }]  
      },
      {
        name:"武僧",
        children:[{
          name:"酒仙",
          url:"/images/wow/career/spell_monk_brewmaster_spec.jpg"
          },{
            name:"踏风",
            url:"/images/wow/career/spell_monk_windwalker_spec.jpg"
          },{
            name:"织雾",
            url:"/images/wow/career/spell_monk_mistweaver_spec.jpg"
          }]  
      },
      {
        name:"德鲁伊",
        children:[{
          name:"野性",
          url:"/images/wow/career/ability_druid_catform.jpg"
          },{
            name:"平衡",
            url:"/images/wow/career/spell_nature_starfall.jpg"
          },{
            name:"守护",
            url:"/images/wow/career/ability_racial_bearform.jpg"
          }
          ,{
            name:"恢复",
            url:"/images/wow/career/spell_nature_healingtouch.jpg"
          }]  
      },
      {
        name:"唤魔师",
        children:[{
          name:"恩护",
          url:"/images/wow/career/ability_paladin_shieldofthetemplar.jpg"
          },{
            name:"湮灭",
            url:"/images/wow/career/ability_paladin_shieldofthetemplar.jpg"
          },{
            name:"增辉",
            url:"/images/wow/career/ability_paladin_shieldofthetemplar.jpg"
          }]  
      },
      {
        name:"恶魔猎手",
        children:[{
          name:"复仇",
          url:"/images/wow/career/ability_demonhunter_specdps.jpg"
          },{
            name:"浩劫",
            url:"/images/wow/career/ability_demonhunter_spectank.jpg"
          }]  
      }
    ]
  },

  /**
   * 组件的方法列表
   */
  methods: {

  }
})